# Maintainer: Morten Linderud <foxboron@archlinux.org>
# Maintainer: Maxim Baz <$pkgname at maximbaz dot com>
# Contributor: Frank Lenormand <lenormf at gmail dot com>
pkgname=kakoune
pkgver=2023.07.29
pkgrel=1
pkgdesc="Multiple-selection, UNIX-flavored modal editor"
arch=("loong64" "x86_64")
url="https://kakoune.org/"
license=("custom:unlicense")
depends=("gcc-libs")
optdepends=(
    "aspell: spell check, correct text"
    "clang: error reporting and diagnostics, completion"
    "editorconfig-core-c: set formatting options project-wide"
    "git: display and cycle through hunks, blame lines, handle file status"
    "kak-lsp: Language Server Protocol (LSP) client"
    "tmux: split windows, spawn tabs"
    "xdotool: X11 window management"
    "xorg-xmessage: print detailed crash information in a separate window"
)
source=("https://github.com/mawww/kakoune/releases/download/v${pkgver}/kakoune-${pkgver}.tar.bz2")
b2sums=('32b3e437904107ec7a64644786fa3de0dec0a7783724ef987244c19ebfd2da03c838e13cc1bf01737f5900bf3376b643bc8f90e4e8d109c70101622bb5a1259a')

build() {
    cd "${pkgname}-${pkgver}/src"
    make
}

check() {
    cd "${pkgname}-${pkgver}/src"
    make test
}

package() {
    cd "${pkgname}-${pkgver}/src"
    make install-strip DESTDIR="${pkgdir}" PREFIX=/usr libexecdir="${pkgdir}/usr/lib/kak"
    install -D ../UNLICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
